const axios = require("axios");
const tokeninfo = require("../../js/user").getTokenInfo();


var Main = {
    data() {
        return {
            props: {
                label: 'name',
                children: 'zones',
                isLeaf: 'leaf'
            },
        };
    },
    methods: {
        loadNode(node, resolve) {
            if (node.level === 0) {
                return resolve([{
                    name: '新点软件'
                }]);
            }
            if (node.level > 1) {
                const test = [{
                    name: 'leaf',
                    leaf: true
                }, {
                    name: 'zone'
                }];

                return resolve(test);
            }

            setTimeout(() => {
                const data = [{
                    name: 'leaf',
                    leaf: true
                }, {
                    name: 'zone'
                }];

                resolve(data);
            }, 500);
        }
    }
};
var Ctor = Vue.extend(Main)
new Ctor().$mount('#app')

function getoulistwithuser() {
    var config = {
        method: 'post',
        url: appconf.resturl + '/rest/oa9/address_getoulistwithuser_v7',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded',
            Authorization: 'Bearer ' + access_token
        },
        params: {
            params: {}
        },
        data: {}
    };

    return axios(config)
        .then(response => {
            let retinfo = dealEpointJson(response.data);
            if (retinfo.status) {
                return Promise.resolve(retinfo);
            } else {
                throw retinfo.text;
            }
        })
        .catch(error => {
            console.error(error);
            return Promise.reject(error);
        });
}
